home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / zmail383.zip / QUERY.DOC < prev    next >
Text File  |  1990-11-02  |  10KB  |  251 lines

  1.  
  2.  
  3. Explanation of Query Builder:
  4.  
  5. The query builder allows you to define a condition which a record must
  6. meet in order for the record to be included in the filter.  While the
  7. query is active, only the records that meet the condition you have
  8. specified will be presented for viewing, editing, printing, etc.  The
  9. other records in your database are still there, but they are temporarily
  10. filtered out. When the filter is turned off, all your records are
  11. available for use again.
  12.  
  13. When you select the query builder, you will be presented with the following
  14. menu:
  15.  
  16.                        Build a new Query
  17.                        Add to current query
  18.                        Count matching records
  19.                        Zap (remove) existing Query
  20.                        Save current Query to disk
  21.                        Restore Query from disk
  22.                        Delete stored queries
  23.                        What is current Query
  24.                        Edit current Query
  25.                        View records matching Query
  26.                        Quit
  27.  
  28. Here is how to build a query:
  29.  
  30. When you select Build a new Query, you will be presented with a list of
  31. the fields in the database you are working with.  Here is an example:
  32.  
  33.  
  34.                        Database Field List
  35.                        < Deleted? >
  36.                        ITEM
  37.                        AMOUNT
  38.                        DATE
  39.                        CHECK_NO
  40.                        TO
  41.                        CATEGORY
  42.                        COMMENTS
  43.                        OK
  44.                        MEMO
  45.  
  46.  
  47. Place the lite bar over the field you want, and press Enter to select
  48. the field.
  49.  
  50. Note: the Deleted option allows you to work with records you may have
  51. marked for deletion but have not yet purged from the database. (Records
  52. may be marked for deletion while in the browse (Use) mode. Records marked
  53. for deletion may be purged with option C on the Services menu.)
  54.  
  55. When you select a field, you will be asked if you wish to further define
  56. the field you have selected.  You will be asked something like:
  57.  
  58.  
  59.              Extend field ITEM with EXPRESSION BUILDER ?
  60.                                 No  Yes
  61.  
  62.  
  63. The default answer in No. In most cases, this is what you will want. If
  64. you have some particular need to further refine the selection of data in
  65. the field you have chosen, you can answer Yes.
  66.  
  67. If you answer Yes, you will be presented with a menu of choices
  68. appropriate to the type of field you have selected, i.e., character,
  69. numeric, date, logical, or memo field.
  70.  
  71. Here are the choices if the field type is character:
  72.  
  73.  
  74.                      E X P R E S S I O N   B U I L D E R
  75.  
  76.         QUIT         and return current expression
  77.         TEST         against database (WYSIWYG)
  78.         UNDO         last change
  79.         HELP         help with expression builder
  80.         EXTRACT      subset or rearrange
  81.         JUSTIFY      left right centered
  82.         CASE         uppercase lowercase proper
  83.         MOVE         spaces to end of string
  84.         ADD          or imbed characters
  85.         SUBSTITUTE   one value for another
  86.         DIFFERENT    change to date or numeric
  87.  
  88.  
  89. Select QUIT to leave the expression builder.
  90.  
  91. Select TEST to test your expression against the current database.
  92.  
  93. Select UNDO to undo your most recent change while using the expression
  94. builder.
  95.  
  96. Select HELP for brief help on using the expression builder.
  97.  
  98. Select EXTRACT if you wish to work with only those records that contain a
  99. desired portion of the data in the character field. For example, assume
  100. the character field you have selected contains a ten character code, and
  101. you want to work with only those codes that contain A99 in the first
  102. three spaces. You could select EXTRACT, then Left 3 characters on the
  103. next screen. The query expression would become LEFT(ITEM,3).
  104.  
  105. After Quitting to the next screen, you would specify EXACTLY EQUAL TO,
  106. and then A99.  If you then Viewed records matching the Query, you would
  107. see only records which contained A99 in the first three spaces of the
  108. item code field.
  109.  
  110. When you return to the main menu, the query expression will be displayed
  111. in the Status box at the bottom of the screen to remind you that the only
  112. records that are active are those which meet the query expression.  You
  113. can toggle the filter (query expression) off by selecting Filter again
  114. from the main menu when you are finished working with the A99 records.
  115.  
  116. Select JUSTIFY if you wish the right justified, left justified, or
  117. centered field data to match some value you are going to specify. An
  118. example of a situation in which you might use this capability would be
  119. where you suspect blank spaces might have been entered in the field,
  120. e.g., " A99" instead of "A99".  By specifying left justified here, and
  121. specifying EXACTLY EQUAL TO A99 at the next screen, you will get all the
  122. A99 records, even those where blanks might have been entered by mistake
  123. at the beginning of the field data.
  124.  
  125. Select CASE if you wish the upper-cased, lower-cased, or properized
  126. (first letter capitalized) field data to match some value you are going
  127. to specify in the next step.
  128.  
  129. Select MOVE to move all spaces, or all but single spaces to the end of a
  130. string. For example:
  131.  
  132. "Merry Christmas to   all" becomes "Merry Christmas to all  " if you move
  133. all but single spaces to the end, and "MerryChristmastoall     " if you
  134. move all spaces to the end.
  135.  
  136. Select ADD if you wish to add or imbed particular characters in the query
  137. expression in order to compare that expression to some value you
  138. will specify in the next step.
  139.  
  140. Select SUBSTITUTE if you want to have the filter substitute one string of
  141. characters for another string so that appropriate matching can take place
  142. against some value you will specify in the next step.
  143.  
  144. Select DIFFERENT if you wish to have the filter convert characters to
  145. numeric or date format so that appropriate matching can take place
  146. against some value you will specify in the next step.
  147.  
  148. ___
  149.  
  150. Other appropriate options for expression building are presented when you
  151. select a numeric, date, logical, or memo field.
  152.  
  153. The basic idea is that the expression builder allows you to further
  154. define the field data you want to match some value you are going to
  155. specify in the next step.
  156.  
  157. ___
  158.  
  159.  
  160. Whether you have used the Expression Builder or not, the next step in
  161. defining your query is presented with the following menu if the field you
  162. are working with is a character field:
  163.  
  164.  
  165.                   =   (EXACTLY EQUAL TO)
  166.                   <>  (NOT EQUAL TO)
  167.                   <   (LESS THAN)
  168.                   >   (GREATER THAN)
  169.                   <=  (LESS THAN OR EQUAL TO)
  170.                   >=  (GREATER OR EQUAL TO)
  171.                   $   (CONTAINS)
  172.                   !$  (DOES NOT CONTAIN)
  173.                   ?*  (WILDCARD MATCH)
  174.                   S   (IS SIMILIAR TO)
  175.                   B   (BEGINS WITH)
  176.                   E   (ENDS WITH)
  177.  
  178.  
  179. What you are being asked to do here is to tell the query builder how you
  180. want the field data (or the expression you defined in the expression
  181. builder) to be compared to some value.
  182.  
  183. For example, if the field you selected is LASTNAME, you can tell the
  184. query builder here that the field contents must be exactly equal to
  185. SMITH, that the field contains JONES, that the field contents begin or
  186. end with some value, etc.
  187.  
  188. Similar appropriate options for field content comparisons are presented
  189. when you select a numeric, date, logical, or memo field.
  190.  
  191. ___
  192.  
  193. When you have finished defining the query expression for the field you
  194. selected, you will be presented with the following choices:
  195.  
  196.                                  DONE
  197.                                  AND
  198.                                  OR
  199.                                  AND NOT
  200.                                  OR NOT
  201.  
  202. If you are done, select DONE and you will be returned to the main query
  203. builder menu. If you wish to include other field specifications in the
  204. query expression, you can select one of the other options, as
  205. appropriate, and repeat the same procedure as above.
  206.  
  207. For example, say your query expression at this point is something like
  208. LASTNAME = "SMITH", and you wanted to work with only those SMITH's who
  209. live in California. Assuming your database contains a two character STATE
  210. field, you would:
  211.  
  212.    1. select AND instead of DONE.
  213.    2. select STATE from the field list.
  214.    3. select EXACTLY EQUAL TO or CONTAINS   (CONTAINS is often better)
  215.    4. enter CA for the state name.
  216.    5. select DONE.
  217.  
  218. Your query expression now contains the appropriate references to both
  219. fields.
  220.  
  221. ___
  222.  
  223.  
  224. When you have created your query expression, Query Active will flash on
  225. the screen. You can now Quit the query builder and return to the main
  226. menu, or select another option from the query builder menu.
  227.  
  228. If you Quit, you will return to the main menu where the query expression
  229. will be displayed in the Status box at the bottom of the screen to remind
  230. you that the only records that are active are those which meet the query
  231. expression.  You can toggle the filter (query expression) off by
  232. selecting Filter again from the main menu.
  233.  
  234. ___
  235.  
  236.  
  237. The other query builder menu options are fairly self-explanatory.
  238.  
  239. One of these options, Edit current Query, allows you to modify the query
  240. expression yourself. Any valid dBase or Clipper function may be used. For
  241. example, if you wanted to specify the trim (field data stripped of any
  242. trailing blanks) of a character field called LASTNAME, you could edit the
  243. query expression to include TRIM(LASTNAME).
  244.  
  245. For a full listing of such functions, please refer to your dBase manual,
  246. Clipper manual, or any of the many reference books on this subject.
  247.  
  248. ___End.
  249.  
  250.  
  251.